package com.zhongwang.mms.module.half.dao;

import com.zhongwang.mms.gen.entity.PAllocationRecord;
import com.zhongwang.mms.module.half.model.AllocationRecordQueryModel;
import com.zhongwang.mms.module.half.model.HOrderDetailModel;
import com.zhongwang.mms.module.purchase.model.PAllocationRecordModel;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PAllocationRecordDao {

    /**
     *@FunctionName: selectAllRecordByQuery
     *@Description: 查询调拨记录表
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:26
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    List<PAllocationRecord> selectAllRecordByQuery(AllocationRecordQueryModel query);
    /**
     *@FunctionName: selectAllRecordByArdFormCode
     *@Description: 根据调拨单号查询调拨记录
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:26
     *@Phone: 18241927380
     */
    List<HOrderDetailModel> selectAllRecordByArdFormCode(String ardFormCode);
    /**
     *@FunctionName: selectInRecordByArdFormCode
     *@Description: 根据调拨单号查询调拨入库
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:27
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    List<HOrderDetailModel> selectInRecordByArdFormCode(String ardFormCode);
    /**
     *@FunctionName: selectOutRecordByArdFormCode
     *@Description: 根据调拨单号查询出库
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:27
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    List<HOrderDetailModel> selectOutRecordByArdFormCode(String ardFormCode);
    /**
     *@FunctionName: updateAllocationByArdId
     *@Description: 根据ID修改调拨记录表信息（数量-----
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:28
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    int updateAllocationByArdId(HOrderDetailModel hOrderDetailModel);
    /**
     *@FunctionName: deleteAllocationByArdId
     *@Description: 根据ID修改调拨记录表状态为无法领料
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:28
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    int deleteAllocationByArdId(HOrderDetailModel hOrderDetailModel);
    /**
     *@FunctionName: selectArdFormCodeByArdId
     *@Description: 根据ID查询调拨单号
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:28
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    String selectArdFormCodeByArdId(Integer ardId);
    /**
     *@FunctionName: updateExecStatusByArdId
     *@Description: 回写状态
     *@CreateDate: 2020/4/23 14:28
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    int updateExecStatusByArdId(HOrderDetailModel hOrderDetailModel);
    /**
     *@FunctionName: getReverseReqCountByArdOdrId
     *@Description: 根据主单获取调拨记录数量
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:24
     *@Phone: 18241927380
     *@Param: [odrId] 主单ID
     *@Return: [Integer] 记录数量
     *@Version: 1.0.0
     */
    Integer getReverseReqCountByArdOdrId(Integer odrId);

    /**
     *@FunctionName: disableRecordByByOdrId
     *@Description: 根据主单使其相关的调拨记录失效
     *@Author: 徐一贺
     *@CreateDate: 2020/4/23 14:25
     *@Phone: 18241927380
     *@Param: [odrId] 主单ID
     *@Return: [Integer] 记录数量
     *@Version: 1.0.0
     */
    void disableRecordByByOdrId(Integer odrId);

    int selectCountByArdFormCode(String odrRepId);

    //冲单回写调拨记录表状态
    int updateExecStatusByArdFormCode(String odrRepId);

    /**
     *getAllocationRecordListByOdrId
     *根据主单ID获取调拨记录
     *@data 2020/4/23 14:23
     *@Param: [odrId] 主单ID
     *@Return: [List<PAllocationRecord>] 调拨记录
     */
    List<PAllocationRecordModel> getAllocationRecordListByOdrId(Integer odrId);
}